package com.xyb.config;

import com.xyb.entity.Message;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

@Component
@EnableScheduling
public class Job {

    //@Resource
    //private WebSocketServer webSocketServer;

    @Scheduled(cron = "0/10 * * * * ?")
    public void job(){
        Message message = new Message();
        message.setMsg(new SimpleDateFormat("yyyy-MM-dd  HH:mm:ss").format(new Date()));
        //webSocketServer.sendMessage2All(message);
    }
}
